﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RCloud.Data
{
    /// <summary>
    /// 更新电影Genres
    /// </summary>
    public class MovieGenresUpdateClass : Doo.DataClass.UpdateClass<REntities, MovieGenres>
    {
        /// <summary>
        /// 电影ID
        /// </summary>
        public int MovieID { get; set; }

        /// <summary>
        /// Genres
        /// </summary>
        public long TagID { get; set; }

        public override MovieGenres GetRecord(REntities container)
        {
            return container.MovieGenres.FirstOrDefault(r => r.MovieID == MovieID && r.TagID == TagID);
        }

        public override MovieGenres CreateRecord(REntities container)
        {
            var mg = new MovieGenres { MovieID = MovieID, TagID = TagID };
            container.AddToMovieGenres(mg);
            return mg;
        }
    }
}
